package com.zte.claa.inficombo.csa.app.service.rptparse.ext.fengyu;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;

/**
 * 
 * @author 0283000115
 *
    sensorno
    createtime
    mptemp1	测点温度1	Double	单位：摄氏度(℃)
	envtemp	环境温度	Double	单位：摄氏度(℃)
	mptemp2	测点温度2	Double	单位：摄氏度(℃)
	humd	湿度	Double	单位：RH
	sm	烟雾	Double	单位：PPM
	current	电流	Double	单位：A
 */
public class FengYuParseResult {
	public static final String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
	public static final String SENSOR_F_NAME = "sensorno";
	public static final String CREATETIME_F_NAME = "createtime";
	// 基本属性.
	private String sensorno; 	// 传感器ID
	private String createtime; 	// yyyy-MM-dd HH:mm:ss格式；
	private double mptemp1;	//	测点温度1	Double	单位：摄氏度(℃)
	private double envtemp;	//	环境温度	Double	单位：摄氏度(℃)
	private double mptemp2;	//	测点温度2	Double	单位：摄氏度(℃)
	private double humd;	//	湿度	Double	单位：RH
	private double sm;		//	烟雾	Double	单位：PPM
	private double current;	//	电流	Double	单位：A	
	
	// 构建器.
	public FengYuParseResult(){
		
	}
	
	/**
	 * 解析上报的当地时间.
	 * 
	 * @return
	 * @throws Exception
	 */
	public Timestamp parseCreatetime(){
		try{
			SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT);
			return new Timestamp(sdf.parse(this.createtime).getTime());	
		}catch(Exception ex){
			return new Timestamp(System.currentTimeMillis());
		}
	}
	
	public String getSensorno() {
		return sensorno;
	}


	public void setSensorno(String sensorno) {
		this.sensorno = sensorno;
	}

	public String getCreatetime() {
		return createtime;
	}


	public void setCreatetime(String createtime) {
		this.createtime = createtime;
	}


	public double getMptemp1() {
		return mptemp1;
	}


	public void setMptemp1(double mptemp1) {
		this.mptemp1 = mptemp1;
	}


	public double getEnvtemp() {
		return envtemp;
	}


	public void setEnvtemp(double envtemp) {
		this.envtemp = envtemp;
	}


	public double getMptemp2() {
		return mptemp2;
	}


	public void setMptemp2(double mptemp2) {
		this.mptemp2 = mptemp2;
	}


	public double getHumd() {
		return humd;
	}


	public void setHumd(double humd) {
		this.humd = humd;
	}


	public double getSm() {
		return sm;
	}


	public void setSm(double sm) {
		this.sm = sm;
	}


	public double getCurrent() {
		return current;
	}


	public void setCurrent(double current) {
		this.current = current;
	}
	
	public String toString(){
		StringBuilder sb = new StringBuilder();		
		sb.append("sensorno=").append(sensorno).append(", "); 	// 传感器ID
		sb.append("createtime=").append(createtime).append(", "); 	// yyyy-MM-dd HH:mm:ss格式；
		sb.append("mptemp1=").append(mptemp1).append(", ");	//	测点温度1	Double	单位：摄氏度(℃)
		sb.append("envtemp=").append(envtemp).append(", ");	//	环境温度	Double	单位：摄氏度(℃)
		sb.append("mptemp2=").append(mptemp2).append(", ");	//	测点温度2	Double	单位：摄氏度(℃)
		sb.append("humd=").append(humd).append(", ");	//	湿度	Double	单位：RH
		sb.append("sm=").append(sm).append(", ");		//	烟雾	Double	单位：PPM
		sb.append("current=").append(current);
		return sb.toString();		
	}

}
